package com.ty.zls.util;

import android.content.Context;
import android.content.SharedPreferences;

public class StrogeUtil {

    public static String user = "user";

    public static String token = "token";


    public static String getStringFraomPs(Context context, String name, String key){
        return context.getSharedPreferences(name, Context.MODE_PRIVATE).getString(key,"");
    }

    public static void setStringPs(Context context,String name,String key,String val){
        SharedPreferences.Editor token = context.getSharedPreferences(name, Context.MODE_PRIVATE).edit();
        token.putString(key,val);
        token.apply();
    }

    public static void rmStringPs(Context context,String name,String key){
        SharedPreferences.Editor sp = context.getSharedPreferences(name, Context.MODE_PRIVATE).edit();
        sp.remove(key);
        sp.apply();
    }


    public static void rmToken(Context context){
        rmStringPs(context,user,token);
    }


}
